<?php /* Smarty version 2.6.25, created on 2013-10-04 01:41:15
         compiled from question/views/admin.manage-product.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'count', 'question/views/admin.manage-product.tpl', 122, false),array('modifier', 'number_format', 'question/views/admin.manage-product.tpl', 304, false),array('block', 'p', 'question/views/admin.manage-product.tpl', 328, false),)), $this); ?>
      
<link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui/css/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui/js/jquery-ui.js"></script>
<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.slug.js"></script>
<!--fancybox-->

    <script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<!--    <link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/fancybox/fancybox.css" rel="stylesheet" type="text/css" />-->

    
<script type="text/javascript">
    //<![CDATA[
jQuery(document).ready(function (){
    //Datepicker
    jQuery( ".date" ).datepicker({
        showAnim        : 'slideDown',
        showButtonPanel : true,
        dateFormat      : '<?php echo $this->_tpl_vars['datepickerFormat']['js']; ?>
'
    });
        
    jQuery("a[rel=thongke]").fancybox({
        'width' : '80%',
        'height' : '80%',
        'transitionIn'  : 'elastic',
        'transitionOut' : 'elastic',
        'type': 'iframe'
    });
    jQuery("a[printBtn").click(function() {
        $('#myIframe')[0].print();
    });

    $('.check-all').click(
            function(){
                $(this).parent().parent().parent().parent().parent().find("input[type='checkbox']").attr('checked', $(this).is(':checked'));   
            }
        );
       
});
        // lay don vi
        var availableUnit = new Array();
        <?php $_from = $this->_tpl_vars['allUnit']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['item']):
?>
        
        availableUnit[<?php echo $this->_tpl_vars['k']; ?>
] = "<?php echo $this->_tpl_vars['item']['name']; ?>
";
         <?php endforeach; endif; unset($_from); ?>
                             
                $( "#unit" )
                    // don't navigate away from the field on tab when selecting an item
                    .bind( "keydown", function( event ) {
                        if ( event.keyCode === $.ui.keyCode.TAB &&
                                $( this ).data( "autocomplete" ).menu.active ) {
                            event.preventDefault();
                        }
                    })
                    .autocomplete({
                        minLength: 0,
                        source: function( request, response ) {
                            // delegate back to autocomplete, but extract the last term
                            response( $.ui.autocomplete.filter(
                                    availableUnit, extractLast( request.term ) ) );
                        },
                        focus: function() {
                            // prevent value inserted on focus
                            return false;
                        },
                    });
function input(id)
{
    jQuery('#input' + id).show();
    jQuery('#more').hide();
            
}
function output(id)
{
    jQuery('#output' + id).show();
    jQuery('#more').hide();
}
function showMenu() {
    $("#unit").autocomplete( "search" , '' );
}
</script> 
    
            <h2>Manage Multichoice</h2>
            
             <!-- End .shortcut-buttons-set -->
            
            <div class="clear"></div> <!-- End .clear -->
           
            
            
            <div class="content-box"><!-- Start Content Box -->
                
                <div class="content-box-header">
                    
                    <div style="float:left;">
                        <a name="listofproduct"><h3></h3></a>
                   </div>     
                   <div style="float:right;padding-right:20px;padding-top:5px;">
                        <form class="search" name="search" method="post" action="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/manage-product">
                            Title <input class="text-input small-input" type="text" name="condition[keyword]" id="keyword" value="<?php echo $this->_tpl_vars['condition']['keyword']; ?>
"/>
                            
                            <select name="condition[product_category_gid]">
                                <option value="">All categories</option>
                            <?php $_from = $this->_tpl_vars['allCats']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
                                <option value="<?php echo $this->_tpl_vars['item']['product_category_gid']; ?>
" <?php if ($this->_tpl_vars['condition']['product_category_gid'] == $this->_tpl_vars['item']['product_category_gid']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['item']['name']; ?>
</option>
                            <?php endforeach; endif; unset($_from); ?>
                            </select> 
                            <input class="button" type="submit" value="Search" />
                        </form>
                        
                   </div>
                    
                </div> <!-- End .content-box-header -->
                
                <div class="content-box-content">
                    
                    <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
                        
                       
                       
                        <!-- MESSAGE HERE -->
                        <?php if (count($this->_tpl_vars['allProduct']) <= 0): ?>
                        <div class="notification information png_bg">
                            <a href="#" class="close"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                No content with above conditions.
                            </div>
                        </div>
                        <?php endif; ?>
                        
                        <?php if (count($this->_tpl_vars['productMessage']) > 0 && $this->_tpl_vars['productMessage']['success'] == true): ?>
                        <div class="notification success png_bg">
                            <a href="#" class="close"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                <?php echo $this->_tpl_vars['productMessage']['message']; ?>

                            </div>
                        </div>
                        <?php endif; ?>
                        
                        <?php if (count($this->_tpl_vars['productMessage']) > 0 && $this->_tpl_vars['productMessage']['success'] == false): ?>
                        <div class="notification error png_bg">
                            <a href="#" class="close"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                <?php echo $this->_tpl_vars['productMessage']['message']; ?>

                            </div>
                        </div>
                        <?php endif; ?>
                        
                        <!-- END MESSAGE -->
                        
                        
                        
                        <form method="POST" name="sortForm">
                        <?php if (count($this->_tpl_vars['allProduct']) > 0): ?>
                        <?php if ($this->_tpl_vars['group'] == 1): ?>
                        <table>
                            <thead>
                                <tr>
                                   <th width="3%"><input class="check-all" type="checkbox" /></th>
                                   <th width="12%">Category</th>
                                  <th width="18%">Title</th>
                                   <th class="center" width="2%">
                                        Sort
                                        <?php if ($this->_tpl_vars['fullPermisison']): ?>
                                        <a href="javascript:document.sortForm.submit();"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/save_16.png" alt="Save sorting"></a>
                                        <?php endif; ?>
                                   </th>
                                   
                                  <th class="center" width="8%">Created Date</th>
                                   <th width="5%">Pub</th>
                                   
                                   
                                    <th width="5%">Level</th>
                                    <th width="11%">Type</th>
                                   
                                   
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            <?php $_from = $this->_tpl_vars['allProduct']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['product'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['product']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['product']['iteration']++;
?>
                                <tr>
                                    <table>
                                        <tr>
                                            <td width="3%"><input type="checkbox" value="<?php echo $this->_tpl_vars['item']['product_id']; ?>
" name="allProduct"/></td>
                                            <td width="12%"><?php echo $this->_tpl_vars['item']['cname']; ?>
</td>
<!--		                                    <td width="7%"><?php echo $this->_tpl_vars['item']['created_date']; ?>
</td>-->
 <td width="18%"><?php echo $this->_tpl_vars['item']['title']; ?>
</td>
		                                    <td class="center" width="2%">
		                                        <?php if ($this->_tpl_vars['fullPermisison']): ?>
		                                        <input name="data[<?php echo $this->_tpl_vars['item']['product_gid']; ?>
]" value="<?php echo $this->_tpl_vars['item']['sorting']; ?>
" size="3" style="text-align: center;"></input>
		                                        <?php else: ?>
		                                        <?php echo $this->_tpl_vars['item']['sorting']; ?>

		                                        <?php endif; ?>
		                                    </td>
                                           
                                            <th class="center" width="8%"><?php echo $this->_tpl_vars['item']['created_date']; ?>
</th>
                                                    <td width="5%">
                                                        <?php if ($this->_tpl_vars['item']['genabled'] == '1'): ?>
                                                            <?php if ($this->_tpl_vars['fullPermisison']): ?>
                                                            <a href="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/disable-product/gid/<?php echo $this->_tpl_vars['item']['product_gid']; ?>
" ><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/visible16x16.png"></a>
                                                            <?php else: ?>
                                                            <img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/visible16x16.png">
                                                            <?php endif; ?>
                                                        <?php else: ?>
                                                            <?php if ($this->_tpl_vars['fullPermisison']): ?>
                                                            <a href="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/enable-product/gid/<?php echo $this->_tpl_vars['item']['product_gid']; ?>
" ><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/invisible16x16.png"></a>
                                                            <?php else: ?>
                                                            <img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/invisible16x16.png">
                                                            <?php endif; ?>
                                                        <?php endif; ?>
                                                    </td>
                                            
                                            <td width="5%"><?php echo $this->_tpl_vars['item']['unit_name']; ?>
</td>
<!--                                            <td width="15%"><?php echo $this->_tpl_vars['item']['created_date']; ?>
</td>-->
                                            <td width="5%">
                                               <?php if ($this->_tpl_vars['item']['enabled'] == '1'): ?>Lecture<?php else: ?>Exercise<?php endif; ?>
                                            </td>
                                           
                                            <td width="6%">
                                                 <?php if ($this->_tpl_vars['fullPermisison']): ?>
                                                 <a href="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/edit-product/id/<?php echo $this->_tpl_vars['item']['product_id']; ?>
" title="Chá»‰nh sá»­a sáº£n pháº©m"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/pencil.png"  alt="Edit Product" /></a>
                                                 <a href="javascript:deleteAProduct(<?php echo $this->_tpl_vars['item']['product_id']; ?>
)" title="XÃ³a sáº£n pháº©m"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/cross.png"  alt="Delete" /></a>
                                                 <?php else: ?>
                                                 --
                                                 <?php endif; ?>
                                            </td>
                                           </tr>
                                           
                                         
                                           <tr>
                                           </tr>
                                           
                                           
                                         
                                           <tr></tr>
                                    
                                    
                                    </table>
                                    <!-- END 1 COL -->
                                </tr>
                            <?php endforeach; endif; unset($_from); ?>                     
                            
                            </tbody>
                        </table>
                        <?php else: ?>
                            <table>
                            <thead>
                                <tr>
                                   <th width="3%"><input class="check-all" type="checkbox" /></th>
                                   <th width="15%">Category</th>
                                   
                                   <th class="center" width="25%">Title</th>
                                   <th width="5%">Hit</th>
                                   <th width="5%">Pub</th>
                                   
                                   <th width="15%">NhÃ  sáº£n xuáº¥t</th>
                                   <th width="10%" style="text-align: right;">Tá»“n kho</th>
                                    <th width="10%">Ä�Æ¡n vá»‹</th>
                                    <th width="10%">Thá»‘ng kÃª</th>
                                   
                                  
                                </tr>
                                
                            </thead>
                         
                         
                            <tbody>
                            
                            <?php $_from = $this->_tpl_vars['allProduct']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['product'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['product']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['product']['iteration']++;
?>
                                <tr>
                                    <table>
                                        <tr>
                                            <td width="3%"><input type="checkbox" value="<?php echo $this->_tpl_vars['item']['product_id']; ?>
" name="allProduct"/></td>
                                            <td width="15%"><?php echo $this->_tpl_vars['item']['cname']; ?>
</td>
<!--                                            <td class="center">-->
<!--                                                <?php if ($this->_tpl_vars['fullPermisison']): ?>-->
<!--                                                <input name="data[<?php echo $this->_tpl_vars['item']['product_gid']; ?>
]" value="<?php echo $this->_tpl_vars['item']['sorting']; ?>
" size="3" style="text-align: center;"></input>-->
<!--                                                <?php else: ?>-->
<!--                                                <?php echo $this->_tpl_vars['item']['sorting']; ?>
-->
<!--                                                <?php endif; ?>-->
<!--                                            </td>-->
                                            <td class="center" width="27%"><?php echo $this->_tpl_vars['item']['title']; ?>
</td>
                                             <td width="5%"><?php echo $this->_tpl_vars['item']['hit']; ?>
</td>
                                                    <td width="6%">
                                                        <?php if ($this->_tpl_vars['item']['genabled'] == '1'): ?>
                                                            <?php if ($this->_tpl_vars['fullPermisison']): ?>
                                                            <a href="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/disable-product/gid/<?php echo $this->_tpl_vars['item']['product_gid']; ?>
" ><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/visible16x16.png"></a>
                                                            <?php else: ?>
                                                            <img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/visible16x16.png">
                                                            <?php endif; ?>
                                                        <?php else: ?>
                                                            <?php if ($this->_tpl_vars['fullPermisison']): ?>
                                                            <a href="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/enable-product/gid/<?php echo $this->_tpl_vars['item']['product_gid']; ?>
" ><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/invisible16x16.png"></a>
                                                            <?php else: ?>
                                                            <img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/invisible16x16.png">
                                                            <?php endif; ?>
                                                        <?php endif; ?>
                                                    </td>
                                            <td width="15%"  ><?php echo $this->_tpl_vars['item']['provider']; ?>
</td>
                                            <td width="10%" class="center"><?php echo number_format($this->_tpl_vars['item']['store'], 0, '.', ' '); ?>
</td>
                                            <td width="10%" class="center"><?php echo $this->_tpl_vars['item']['unit_name']; ?>
</td>
<!--                                            <td width="15%"><?php echo $this->_tpl_vars['item']['created_date']; ?>
</td>-->
                                            <td width="10%">
                                                 <a href="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/select/id/<?php echo $this->_tpl_vars['item']['product_id']; ?>
" title="Thá»‘ng KÃª Sáº£n Pháº©m" rel="thongke"  ><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/tk.png" alt="Thong ke" title="Thá»‘ng kÃª"/></a>
                                            </td>
                                           
                                           </tr>
                                           
                                           
                                    
                                    
                                    </table>
                                    <!-- END 1 COL -->
                                </tr>
                            <?php endforeach; endif; unset($_from); ?>                     
                            
                            </tbody>
                        </table>
                        <?php endif; ?>
                        </form>
                        
                        <br/>
                        <!-- CHOOSE ACTION -->
                        <?php $this->_tag_stack[] = array('p', array('name' => 'edit_product','module' => 'product')); $_block_repeat=true;Nine_View_Register_Permission::checkPermisison($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>
                        <div class="bulk-actions align-left" style="float: left;padding-top: 14px;">
                            <select id="action">
                                <option value=";">Choose an action...</option>
                                <?php $this->_tag_stack[] = array('p', array('name' => 'delete_product','module' => 'product')); $_block_repeat=true;Nine_View_Register_Permission::checkPermisison($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>
                                <option value="deleteProduct();">Delete</option>
                                <?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo Nine_View_Register_Permission::checkPermisison($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?>
                                <option value="enableProduct();">Enable</option>
                                <option value="disableProduct();">Disable</option>
                            </select>
                            <a class="button" href="javascript:applySelected();">Apply to selected</a>
                        </div>
                        <?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo Nine_View_Register_Permission::checkPermisison($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?>
                        
                        <div class="bulk-actions align-left" style="float: left;padding-top: 10px; padding-left:30px;">
                            <form class="search" name="search" method="post" action="<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/manage-product">
                                Display #
                                <select name="displayNum" onchange="this.parentNode.submit();" style="clear: both;">
                                    <option value="5" <?php if ($this->_tpl_vars['displayNum'] == 5): ?> selected="selected" <?php endif; ?>>5</option>
                                    <option value="10" <?php if ($this->_tpl_vars['displayNum'] == 10): ?> selected="selected" <?php endif; ?>>10</option>
                                    <option value="20" <?php if ($this->_tpl_vars['displayNum'] == 20): ?> selected="selected" <?php endif; ?>>20</option>
                                    <option value="50" <?php if ($this->_tpl_vars['displayNum'] == 50): ?> selected="selected" <?php endif; ?>>50</option>
                                    <option value="100" <?php if ($this->_tpl_vars['displayNum'] == 100): ?> selected="selected" <?php endif; ?>>100</option>
                                    <option value="1000000000" <?php if ($this->_tpl_vars['displayNum'] >= 1000000000): ?> selected="selected" <?php endif; ?>>All</option>
                                </select>
                            </form>
                        </div>
                        
                        <!-- PAGINATION -->
                        <?php if ($this->_tpl_vars['countAllPages'] > 1): ?>
                        <div class="pagination" style="float: right;">
                            <?php if ($this->_tpl_vars['first']): ?>
                            <a href="?page=1" class="number" title="First Page">&laquo; First</a>
                            <?php endif; ?>
                            <?php if ($this->_tpl_vars['prevPage']): ?>
                            <a href="?page=<?php echo $this->_tpl_vars['prevPage']; ?>
" class="number" title="Previous Page">&laquo;</a>
                            <?php endif; ?>
                            
                            <?php $_from = $this->_tpl_vars['prevPages']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
                            <a href="?page=<?php echo $this->_tpl_vars['item']; ?>
" class="number" title="<?php echo $this->_tpl_vars['item']; ?>
"><?php echo $this->_tpl_vars['item']; ?>
</a>
                            <?php endforeach; endif; unset($_from); ?>
                            
                            <a href="#" class="number current" title="<?php echo $this->_tpl_vars['currentPage']; ?>
"><?php echo $this->_tpl_vars['currentPage']; ?>
</a>
                            
                            <?php $_from = $this->_tpl_vars['nextPages']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
                            <a href="?page=<?php echo $this->_tpl_vars['item']; ?>
" class="number" title="<?php echo $this->_tpl_vars['item']; ?>
"><?php echo $this->_tpl_vars['item']; ?>
</a>
                            <?php endforeach; endif; unset($_from); ?>
                            
                            <?php if ($this->_tpl_vars['nextPage']): ?>
                            <a href="?page=<?php echo $this->_tpl_vars['nextPage']; ?>
" class="number" title="Next Page">&raquo;</a>
                            <?php endif; ?>
                            <?php if ($this->_tpl_vars['last']): ?>
                            <a href="?page=<?php echo $this->_tpl_vars['countAllPages']; ?>
" class="number" title="Last Page">Last &raquo;</a>
                            <?php endif; ?>
                        </div> <!-- End .pagination -->
                        <?php endif; ?>
                    <?php endif; ?>    
                        
                        <div class="clear"></div>
                    </div> <!-- End #tab1 -->
                    
                    
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
            
            
            <div class="clear"></div>
            
<script language="javascript" type="text/javascript">
$(document).ready(function(){
    document.getElementById('keyword').select();
    document.getElementById('keyword').focus();
});

function applySelected()
{
	var task = document.getElementById('action').value;
	eval(task);
}
function enableProduct()
{
    var all = document.getElementsByName('allProduct');
    var tmp = '';
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
        }
    }
    if ('' == tmp) {
        alert('Please choose an product');
    }
    window.location.href = '<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/enable-product/gid/' + tmp;
}

function disableProduct()
{
    var all = document.getElementsByName('allProduct');
    var tmp = '';
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
        }
    }
    if ('' == tmp) {
        alert('Please choose an product');
    }
    window.location.href = '<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/disable-product/gid/' + tmp;
}

function deleteProduct()
{
    var all = document.getElementsByName('allProduct');
    var tmp = '';
    var count = 0;
    for (var i = 0; i < all.length; i++) {
        if (all[i].checked) {
             tmp = tmp + '_' + all[i].value;
             count++;
        }
    }
    if ('' == tmp) {
        alert('Please choose an product');
        return;
    } else {
    	result = confirm('Are you sure you want to delete ' + count + ' product(s)?');
        if (false == result) {
            return;
        }
    }
    window.location.href = '<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/delete-product/gid/' + tmp;
}


function deleteAProduct(id)
{
    result = confirm('Are you sure you want to delete this product?');
    if (false == result) {
        return;
    }
    window.location.href = '<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/delete-product/gid/' + id;
}
</script>